package com.training.java.core.collections.car.pre15;

public class Car implements Comparable<Car>
{
	private String make;
	private String model;
	private int year;
	private int price;
	
	public Car()
	{}
	
	public Car(String make,String model,int year)
	{
		this.make=make;
		this.model=model;
		this.year=year;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public String getMake() {
		return make;
	}

	public String getModel() {
		return model;
	}

	public int getYear() {
		return year;
	}

	@Override
	public boolean equals(Object obj)
	{
		if (obj instanceof Car)
		{
			Car car = (Car)obj;
			return (this.make.equals(car.make) && this.model.equals(car.model));
		}
		else 
		{
		return false;
		}
	}
	@Override
	public int hashCode()
	{
		
		return this.make.hashCode();
	}

	/*@Override
	public int compareTo(Object o) {
		Car car = (Car)o;
		return this.make.compareTo(car.make);
		//return this.model.compareTo(car.model);
		
		
	}
*/
	@Override
	public int compareTo(Car o) {
		return this.make.compareTo(o.make);
		
	}
	
	
	

}
